#ifndef __HANDLECOLLISIONS_H__
#define __HANDLECOLLISIONS_H__

#include <iostream>
#include "Point.h"
#include "Shape.h"
#include "MyScreen.h"

class Circle;
class CRectangle;

using namespace std;

class HandleCollisions
{
public:
	static int whichShapeToDelay (const double& shape1DirX, const double& shape1DirY,
		const bool& collisionX, const bool& collisionY); 
	static int whichShapeHasBiggerDir (const double& shape1DirX, const double& shape1DirY);
	static void checkRecToRecCollision (const Point& rec1UL,const  Point& rec1DR,const  Point& rec2UL, const Point& rec2DR,
		bool& collisionX,  bool& collisionY);
	static bool checkRecToRecCollisionX ( const int& rec1YU, const int& rec1YD, const int& rec2YU, const int& rec2YD);
	static bool checkRecToRecCollisionY ( const int& rec1YU, const int& rec1YD, const int& rec2YU, const int& rec2YD);
	static bool rec1PartInRec2 (const  Point& rec1UL, const  Point& rec1UR, const  Point& rec1DL,const Point& rec1DR,
		const   Point& rec2UL,const   Point& rec2DR);
	static int pointInsideRec (const  Point& rec1UL,const  Point& rec1DR,const  Point& point);
	static int checkRecCollision(const CRectangle & rec1 ,const  Point & colPoint); 
	static int isCircOnRec(const Circle & circ2 , const CRectangle & rec1 );
	static int checkCircCollisionX(const Circle & circ , const Point & colPoint);
	static bool isRecOnCircle(const CRectangle & rec1 ,const Circle & circ2 , Point & colPoint);
	static bool getCircRecColPoint (int x1 ,int y1 ,int x2 , int  y2 , int radius , Point & colPoint );
	static void isRecCollideWithCir (CRectangle * rec1 , Circle * circ2, int& dir, bool& circ2CollisionX,
									bool& circ2CollisionY , bool& rec1CollisionX , bool& rec1CollisionY); 
	static void updateDir( Shape &shape1 , Shape &shape2 , bool shape1ColX, bool shape1ColY , bool shape2ColX , bool shape2ColY);
	static bool isCircleToCircleOverlap(const Circle &circ1 , const Circle &circ2);
	static bool getCircToCircOutsideColPoint(const Circle &circ1 ,const Circle &circ2 , Point & colPoint);
	static bool getCircToCircInsideColPoint(const Circle &circ1 ,const Circle &circ2 , Point & colPoint);
	static int checkCollisionX(const Circle & circ1 , const Point & colPoint);
	static bool checkRecStuck (const CRectangle & rec1 , const MyScreen & scr);
	static bool checkCircStuck (const Circle & circ1 , const MyScreen & scr);
	static bool check4Points (double x, double y, double currXAxis, double currYAxis,const MyScreen & scr);
	static bool pointOnCirc (const Circle & circ1 ,const Point & p );
	static bool pointOnCircNext (const Circle & circ1 ,const Point & p );
	static void handleCircleCircleCollision (Circle * circ1 , Circle * circ2);
	static void handleCircleRectangleCollision (Circle * circ1 , CRectangle * rec2);
	static void handleRectangleCircleCollision (CRectangle * rec1 , Circle * circ2);
	static void handleRectangleRectangleCollision (CRectangle * rec1 , CRectangle * rec2);
	static bool checkIfRecStuckInRec (const CRectangle * rec1 , const CRectangle * rec2);

};

#endif

